<template>
  <div class="search">
    <van-nav-bar title="搜索" left-text="返回" left-arrow @click-left="() => $router.go(-1)" />
    <van-search v-model="searchValue" placeholder="请输入搜索关键词" @search="onSearch" />
    <momentStrip v-for="(item, index) in searchList" :key="index" :pieceData="item" :showOpera="true" />
  </div>
</template>

<script>
import momentStrip from "@/components/momentStrip";

export default {
  components: {
    momentStrip,
  },
  data() {
    return {
      searchValue: '',
      searchList: []
    }
  },
  methods: {
    onSearch(val) {
      this.$axios.get(`/getSearch?value=${val}`).then(res => {
        if (res.code === 200) {
          this.searchList = res.data
        }
      })
    }
  }
}
</script>

<style scoped>
</style>